<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>
<script type="text/javascript" src="/thirdparty/My97DatePicker/WdatePicker.js"></script>

<script language="javascript">
<!--
	var notify_editor;
	$(function(){
	
		//初始化富文本框
		var toolbars = [['FullScreen','Source','Link','Unlink','Preview','InsertImage','Emotion','Spechars','Bold','Italic',
		     			'Underline','StrikeThrough','ForeColor','BackColor','JustifyLeft','JustifyCenter','JustifyRight','JustifyJustify',
		     			'Paragraph','FontFamily','FontSize','ImageNone','ImageLeft','ImageRight','ImageCenter']];
	 	var initialStyle = 'body{font-family:"宋体";font-size:12px;}';
	 	var initArgus = {
	 		toolbars:toolbars,
	 		wordCount:false,
	 		minFrameHeight:50,
	 		initialStyle: initialStyle,
	 		elementPathEnabled : false
	 	}
		notify_editor = new baidu.editor.ui.Editor({
			toolbars:toolbars,
			wordCount:false,
			minFrameHeight:50,
			initialStyle: initialStyle,
			elementPathEnabled : false,
			textarea:'add_info'
		});
	    notify_editor.render("add_info");
	    
	});
	//添加信息
	function addInfo(){
		var title = $("#title").val();
		var keywords = $("#keywords").val();
		var summary = $("#summary").val();
		var content = notify_editor.getContent();
		var author = $("#author").val();
		var source = $("#source").val();
		var releaseTime = $("#releaseTime").val();
		var picture = $("#picture").attr("src");
		var picture2 = $("#picture2").attr("src");
		var hyperlink = $("#hyperlink").val();
		$.post("/misc/info/addInfo.htm",{
			title : title,
			keywords : keywords,
			summary : summary,
			content : content,
			author : author,
			source : source,
			releaseDate : releaseTime,
			picture : picture,
			picture2 : picture2,
			hyperlink : hyperlink
		},function(data){
			if(data=="success"){
				parent.grid_ae.loadData();
				$.ligerDialog.success("添加成功！");
			}else{
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
	}
	
	//预览信息
	function previewInfo(){
		var title = $("#title").val();
		var keywords = $("#keywords").val();
		var summary = $("#summary").val();
		var content = notify_editor.getContent();
		var author = $("#author").val();
		var source = $("#source").val();
		var releaseTime = $("#releaseTime").val();
		var picture = $("#picture").attr("src");
		var picture2 = $("#picture2").attr("src");
		var hyperlink = $("#hyperlink").val();
		$.post("/misc/info/savePreviewInfo.htm",{
			title : title,
			keywords : keywords,
			summary : summary,
			content : content,
			author : author,
			source : source,
			releaseDate : releaseTime,
			picture : picture,
			picture2 : picture2,
			hyperlink : hyperlink
		},function(){
			parent.parent.$.ligerDialog.open({ height: 1024,width:960, url: "/misc/info/previewInfo.htm", isResize: true ,modal:true, closeWhenEnter:true,showMax : true,title:'预览内容'});
		});
	}
	
//-->
</script>
<table width="100%" class="def_t">
	<tr>
		<td>标题：</td>
		<td><input type="text" id="title" style="width: 725px;"></td>
	</tr>
	<tr>
		<td>关键字：</td>
		<td><input type="text" id="keywords" style="width: 725px;"></td>
	</tr>
	<tr>
		<td>摘要：</td>
		<td><textarea cols="100" id="summary" rows="5"></textarea></td>
	</tr>
	<tr>
		<td>内容：</td>
		<td><textarea  id="add_info" name="add_info" style="width:725px" ></textarea></td>
	</tr>
	<tr>
		<td>作者：</td>
		<td><input type="text" id="author" style="width: 725px;"></td>
	</tr>
	<tr>
		<td>来源：</td>
		<td><input type="text" id="source" style="width: 725px;"></td>
	</tr>
	<tr>
		<td>超链接：</td>
		<td><input type="text" id="hyperlink" style="width: 725px;"></td>
	</tr>
	<tr>
		<td>图片1：</td>
		<td>
			<form enctype="multipart/form-data" method="post" action="/misc/cms/uploadCmsImg.htm">
				<input type="file" onchange="uploadCmsImg(this);return false;"
				style="width: 200px;"  title="支持jpg、jpeg、gif、png格式，文件小于2M" name="imagef" id="imagef"/>
			</form>
			<img id="picture" width="100" height="100">
		</td>
	</tr>
	<tr>
		<td>图片2：</td>
		<td>
			<form enctype="multipart/form-data" method="post" action="/misc/cms/uploadCmsImg.htm">
				<input type="file" onchange="uploadCmsImg(this);return false;"
				style="width: 200px;"  title="支持jpg、jpeg、gif、png格式，文件小于2M" name="imagef" id="imagef"/>
			</form>
			<img id="picture2" width="100" height="100">
		</td>
	</tr>
	<tr>
		<td>发布时间：</td>
		<td><input type="text" id="releaseTime" onclick="WdatePicker({el:'releaseTime',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true});" style="width: 725px;"></td>
	</tr>
	<tr>
		<td colspan="2" align="center">
			<button type="button" onclick="addInfo()">保存</button>
			<button type="button" onclick="previewInfo()">预览</button>
		</td>
	</tr>
</table>
